<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>javascript-switch语句</title>
</head>
<body>
<script>
    var d = new Date();
    var w = d.getDay(); //0-6  星期日  1星期一 6星期六
    //document.write(w);
    switch (w) {
        case 1:
            document.write("星期一");
            break;
        case 2:
            document.write("星期二");
            break;
        case 3:
            document.write("星期三");
            break;
        case 4:
            document.write("星期四");
            break;
        case 5:
            document.write("星期五");
            break;
        case 6:
            document.write("星期六");
            break;
        default:
            document.write("星期日");
            break;
    }
</script>
</body>
</html>